package com.example.demo.controller;

import com.example.demo.domain.Teacher;
import com.example.demo.service.TeacherService;
import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: demo
 * @description:
 * @author: 陈程猿
 * @create: 2024-11-27 08:39
 **/
@Controller
@RequestMapping("/teacher")
public class TeacherController {

    @Resource
    private TeacherService teacherService;


    /**
     * 获取教师列表
     * @param model
     * @return
     */
    @RequestMapping("/list")
    public String getAllTeacher(Model model){
        List<Teacher> teacherList = this.teacherService.findAllTeacher();
        model.addAttribute("teacherList",teacherList);
        return "/teacher/teacherList";
    }
}
